<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Create Timesheet</title>
<link href="<%=request.getContextPath() %>/styles/jquery-ui-1.8.18.custom.css" rel="stylesheet" type="css/text"/>
<style type="text/css">
.ui-datepicker-calendar {
    display: none;
    }​
</style>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jquery-ui-calendar.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$("#month").datepicker({dateFormat:"mm-yy",
		changeMonth: true,
        changeYear: true,
        showButtonPanel: true,
        onClose: function(dateText, inst) { 
            var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
            var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
            $(this).datepicker('setDate', new Date(year, month, 1));
        }
	});
	
	$("#form").submit(function(){
		$.post("<%=request.getContextPath()%>/timesheet/generateTimesheet",$(this).serialize(),function(data){
			if(data.success){
				showNoticeMessage("Data Saved klick <a href='<%=request.getContextPath()%>/timesheet/updateDetail/"+data.data+"'>here</a> to process data");
				document.location="#flash";
			}
		},"json").success(function(){
			
		}).error(function(xhr,textStatus,errorThrown){
			showErrorMessage("Save Failed, Reason:"+errorThrown);
		}).complete(function(){
		});
		return false;
	});
});
</script>
</head>
<body>
	<div class="block" id="block-form">
		<div class="content">
		<a name="flash"></a>
			<div class="flash">
			</div>
			<div class="inner">
				<h2 class="title">Create Timesheet</h2>
				<form:form  id="form" method="post" cssClass="form"
					modelAttribute="timesheetmodel">
					<div class="group">
						<form:label cssClass="label" for="month" path="month">Bulan</form:label>
						<form:input cssClass="text_field" path="month" id="month" type="text" />
						<span class="description">Bulan Timesheet (mm-yyyy)</span>
					</div>
					<div class="group">
						<form:label cssClass="label" for="nama" path="nama"></form:label>
						<form:input cssClass="text_field" type="text" path="nama" />
						<span class="description">Nama</span>
					</div>
					<div class="group">
						<form:label cssClass="label" for="uid" path="uid">Nomor Induk</form:label>
						<form:input cssClass="text_field" type="text" path="uid" />
						<span class="description">Nomor Induk Pekerja</span>
					</div>
						<div class="group">
						<form:label cssClass="label" for="pemeriksa" path="pemeriksa">Pemeriksa</form:label>
						<form:input cssClass="text_field" type="text" path="pemeriksa" />
						<span class="description">Nama Pemeriksa</span>
					</div>
					<div class="group">
						<form:label cssClass="label" for="disetujui" path="disetujui">Penyetuju</form:label>
						<form:input cssClass="text_field" type="text" path="disetujui" />
						<span class="description">Nama Penyetuju</span>
					</div>
					<div class="group">
						<form:label cssClass="label" for="project_name" path="project_name">Project Name</form:label>
						<form:input cssClass="text_field" type="text" path="project_name" />
						<span class="description">Nama Project</span>
					</div>
					<div class="group">
						<form:label cssClass="label" for="location" path="location">Lokasi</form:label>
						<form:input cssClass="text_field" type="text" path="location" />
						<span class="description">Lokasi Kerja</span>
					</div>
					<div class="group navform wat-cf">
						<button class="button" type="submit">
							<img src="/images/icons/tick.png" alt="Save"> Save
						</button>
						<button class="button" type="reset">Reset</button>
					</div>

				</form:form>
			</div>
		</div>
	</div>
</body>
</html>